<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: TT
  Date: 2020/10/21
  Time: 15:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
    <link rel="stylesheet" href="css/index2.css">
    <script type="text/javascript">
        function del(sid) {
            alert(sid);
            $.post("del",{"sid":sid},function (number) {
                alert(number);
                if (number>0){
                    alert("删除成功");
                }else {
                    alert("删除失败");
                }
                location="list";
            },"json");
        }
        function up(sid) {
            location="update.jsp?sid="+sid;
        }
    </script>
</head>
<body>
<a href="add.jsp">添加</a>
<table>
    <tr>
        <td colspan="20">
            <form method="post" action="list">
                按名字查询:<input type="text" name="sname" value="${sname}">
                <input type="submit" value="查询">
            </form>
        </td>
    </tr>
    <tr>
        <td>编号</td>
        <td>学号</td>
        <td>姓名</td>
        <td>性别</td>
        <td>年龄</td>
        <td>类别</td>
        <td>学科</td>
        <td>学校</td>
        <td>加分类型</td>
        <td>加分</td>
        <td>操作</td>
    </tr>
    <c:forEach items="${plist.list}" var="a">
        <tr>
            <td>${a.sid}</td>
            <td>${a.sno}</td>
            <td>${a.sname}</td>
            <td>${a.sex}</td>
            <td>${a.birthday}</td>
            <td>${a.category}</td>
            <td>${a.subject}</td>
            <td>${a.school}</td>
            <td>${a.cname}</td>
            <td>${a.score}</td>
            <td>
                <input type="button" value="删除" onclick="del(${a.sid})">
                <input type="button" value="修改" onclick="up(${a.sid})">
            </td>
        </tr>
    </c:forEach>
    <tr>
        <td colspan="20">
            <a href="list?pageNum=${plist.prePage}">上一页</a>
            <c:forEach step="1" begin="1" end="${plist.pages}" var="s">
                <a href="list?pageNum=${s}">${s}</a>
            </c:forEach>
            <a href="list?pageNum=${plist.nextPage}">下一页</a>
        </td>
    </tr>
</table>
</body>
</html>
